using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;

namespace Janus.NorthwindDemo2007
{
	public partial class SupplierControl
	{

		protected override void OnDataSourceChanged()
		{
			this.AddBinding(this.editCompanyName, "Text", "Suppliers.CompanyName");
			this.AddBinding(this.editContactName, "Text", "Suppliers.ContactName");
			this.AddBinding(this.editContactTitle, "Text", "Suppliers.ContactTitle");
			this.AddBinding(this.editSupplierID, "Text", "Suppliers.SupplierID");
			this.AddBinding(this.editAddress, "Text", "Suppliers.Address");
			this.AddBinding(this.editCity, "Text", "Suppliers.City");
			this.AddBinding(this.editCountry, "Text", "Suppliers.Country");
			this.AddBinding(this.editFax, "Text", "Suppliers.Fax");
			this.AddBinding(this.editPhone, "Text", "Suppliers.Phone");
			this.AddBinding(this.editPostalCode, "Text", "Suppliers.PostalCode");
			this.AddBinding(this.editRegion, "Text", "Suppliers.Region");
		}

		protected override void OnAllowEditChanged()
		{
			this.editSupplierID.ReadOnly = (! this.AllowEdit) | (! this.IsAddNew);

			this.editCompanyName.ReadOnly = ! this.AllowEdit;
			this.editContactName.ReadOnly = ! this.AllowEdit;
			this.editContactTitle.ReadOnly = ! this.AllowEdit;
			this.editAddress.ReadOnly = ! this.AllowEdit;
			this.editCity.ReadOnly = ! this.AllowEdit;
			this.editCountry.ReadOnly = ! this.AllowEdit;
			this.editFax.ReadOnly = ! this.AllowEdit;
			this.editPhone.ReadOnly = ! this.AllowEdit;
			this.editPostalCode.ReadOnly = ! this.AllowEdit;
			this.editRegion.ReadOnly = ! this.AllowEdit;
		}



		public override System.Drawing.Size FullSize
		{
			get
			{
				return new Size(592, 250);
			}
		}

		protected override void OnUseTabBackgroundChanged()
		{
			if (this.UseTabBackground)
			{
				this.gbBackground.BackgroundStyle = Windows.EditControls.BackgroundStyle.TabPage;
			}
			else
			{
				this.gbBackground.BackgroundStyle = Windows.EditControls.BackgroundStyle.Panel;
			}
		}
	}

} //end of root namespace